package engine.objects;

import java.io.Serializable;

public class Line implements Serializable{

	private static final long serialVersionUID = 1L;

	private float x1, y1 ; 
	private float x2, y2 ;
	
	public Line(float x1, float y1, float x2, float y2) {
		super();
		this.setX1(x1);
		this.setX2(x2); 
		this.setY1(y1); 
		this.setY2(y2); 
	}
	public float getX1() {
		return x1;
	}
	public void setX1(float x1) {
		this.x1 = x1;
	}
	public float getY1() {
		return y1;
	}
	public void setY1(float y1) {
		this.y1 = y1;
	}
	public float getX2() {
		return x2;
	}
	public void setX2(float x2) {
		this.x2 = x2;
	}
	public float getY2() {
		return y2;
	}
	public void setY2(float y2) {
		this.y2 = y2;
	} 
	
	public float getGradient(){
		float dy = y2-y1 ; 
		float dx = x2-x1 ;
		if(dx == 0) dx = 1 ; 
		float res = Math.abs(dy/dx) ; 
		return  res ; 
	}
	
}
